package com.ying.dogying.im;

import org.tio.websocket.server.WsServerStarter;

import java.io.IOException;

/**
 * ws服务启动类
 */
public class ServerStartup {

    private ImMessageHandler messageHandler;
    private WsServerStarter wsServerStarter ;

    public ServerStartup(int imPort) throws IOException {
        messageHandler = new ImMessageHandler();
        wsServerStarter = new WsServerStarter(imPort, messageHandler);
        wsServerStarter.getServerTioConfig().setHeartbeatTimeout(120000);// 设置心跳超时时间为两分钟
    }

    public void start() throws IOException {
        this.wsServerStarter.start();
    }

}
